from django.utils.translation import ugettext_lazy as _
# from django.contrib import admin
from sorl import curator as admin

from chimichanga.banner_viewer.models import *
import re

class BannerAdmin(admin.ModelAdmin):
    list_display = list_display_links = ('name',  'date', 'size', 'width', 'height', )
    list_filter = ('active', 'size', 'date', )
    fieldsets = (
              ("Banner Info", {
                  'fields': ('active', 'name','banner', 'panel', )
              }),
             ("Banner Size info. Only change width and height if \"Custom\" is selected for size.", {
                 'fields': ('page_template','size','width','height',)
              }),
             ("Expandable Settings", {
                 'fields': ('is_expandable','direction','expandable_width','expandable_height',)
             }),
          )

class CoceptAdmin(admin.ModelAdmin):
    list_display = list_display_links = ('name', 'date', 'show_delivery')
    list_filter = ('active', 'date', 'show_delivery')
    filter_horizontal = ('banners',)
    
class PageTemplateAdmin(admin.ModelAdmin):
    list_display = list_display_links = ('name', 'size')
    list_filter = ('active', )    
    
class CampaignAdmin(admin.ModelAdmin):
    list_display = list_display_links = ('name', 'date', 'show_delivery')
    list_filter = ('active', 'date', 'show_delivery')
    prepopulated_fields = {'slug': ('name',)}
    filter_horizontal = ('concepts',)
    
admin.site.register(Banner, BannerAdmin)
admin.site.register(Concept, CoceptAdmin)
admin.site.register(Campaign, CampaignAdmin)
admin.site.register(Page_Template, PageTemplateAdmin)
